<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>欢迎登录后台管理系统</title>
<link href="__STATIC__/Admin/css/base.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/Admin/css/right.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/Admin/css/select.css" rel="stylesheet" type="text/css">

<script src="__STATIC__/js/jquery-2.1.1.min.js"></script>
<script src="__STATIC__/js/select-ui.min.js"></script>

<script>
$(document).ready(function(){	
   $(".select1").uedSelect({
		width : 345		  
   });
});
function removeFile(e){	$(e).parent().parent().remove();}
</script>
</head>
<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li><a href="{:url('Index/center')}">首页</a></li>
    <li><a href="{:url('index')}">代理佣金</a></li>
    <li>编辑</li>
  </ul>
</div>
<div class="formbody">
  <div class="formtitle"><span>基本信息</span></div>
  <form id="fadd" name="fadd" method="post" action="{:url('save?id=')}" onsubmit="return onCheckAll();">
   <ul class="forminfo">   
    <li>
      <label>代理等级</label>
      <div class="vocation">
      <select name="ydengji" class="select1">
        <option value="1"  > 1</option>
        <option value="2"  > 2</option>
        <option value="3" > 3</option>
      </select>
      </div>
      </li>
    <li>
      <label>提成比例</label>
      <input name="ybaifenbi" type="text" value="5" class="dfinput" >
      <i></i></li>
    <li>
      <label>&nbsp;</label>
      <input type="submit" name="button" class="btn" value="确认保存" />
    </li>
  </ul>
  </form>
</div>
<div class="install"></div>

<script>
 function validateFloat1(val){
	var reg = /^\+?(\d*\.\d{1,2})$/;

	 return reg.test(val);
	 }
	function validateFloat2(val){
	var reg = /^\+?(\d*\.\d{3})$/;

	 return reg.test(val);
	 }

	 
	function validateInt(val){
	var reg = /^\+?[0-9][0-9]*$/;

	 return reg.test(val);
	 }
function onCheckAll(){
	  var t = $('#fadd').serializeArray();
	  var d = {};
	  var res = true;
	  $.each(t, function() {
		  var obj = this;
		  if(!validateFloat1(obj.value)&&!validateFloat2(obj.value)&&!validateInt(obj.value)){
			  res=false;
			  $("input[name='"+obj.name+"']").css("border","solid 1px red");
		  }else{
			  $("input[name='"+obj.name+"']").css("border","solid 1px gray");
		  } 
	    });
	   return res;
}
</script>
</body>
</html>